<?php 
class LoginForm extends sfForm
{
  public function configure()
  {
	$this->setWidgets(array(
      'login'   => new sfWidgetFormInput(),
      'pass'   => new sfWidgetFormInputPassword()
	));
	
	$this->widgetSchema->setNameFormat('login[%s]');
	
	$this->widgetSchema->setLabels(array(
      'login'   => "Login",
      'pass'   => "Password"
	));
	
	$this->setValidators(array(
      'login'   => new sfValidatorAnd(
	  		array(
				new sfValidatorString(
					array('required' => true, 'min_length' => 3, 'max_length' => 14),
					array(
						'min_length' => "The login is too short. 3 characters minimum.", 
						'max_length' => "The login is too long. 14 characters maximum", 
					)
				),
				new sfValidatorRegex(
					array('pattern' => '/^[a-zA-Z0-9-]+$/')
				)
			),
			array(),
			array(
				'required' => "The login is required",
				'invalid' => "The nickname could not contain special characters."	
			)
	  ),
      'password'   => new sfValidatorString(
			array('required' => true, 'min_length' => 6, 'max_length' => 20), 
			array(
				'min_length' => "The password is too short. 6 characters minimum.", 
				'max_length' => "The password is too long. 20 characters maximum", 
				'required' => "Password is required", 
				'invalid' => "The password must contains between 6 and 20 characters"
			)
	  ),
	));
	
  }
}
?>